#include "cpu/exec/template-start.h"

#define instr je

static void do_execute() {
    // printf("zero flag = %d\n", cpu.eflags.ZF);
    if (cpu.eflags.ZF) { // 检查零标志位是否被置位
        cpu.eip += op_src->val;
        // printf("op_src->val = %x\n", op_src->val);
        print_asm(str(instr) " %x", cpu.eip + 1 + DATA_BYTE);
        // printf("eip = %x\n", cpu.eip);

    } else {
        // printf("eip1 = %x\n", cpu.eip);
        // cpu.eip += DATA_BYTE; // 跳过操作数，继续执行下一条指令
        // printf("eip1 = %x\n", cpu.eip);
        print_asm(str(instr) " %x", cpu.eip);
    }
}

make_instr_helper(si)

#if DATA_BYTE == 4
make_helper(je_rm_l) {
    int len = decode_rm_l(eip + 1);
    if (cpu.eflags.ZF) {
        cpu.eip = op_src->val - (len + 1);
        print_asm(str(instr) " *%s", op_src->str);
    } else {
        cpu.eip += len + 1;
    }
    return len + 1;
}
#endif

#include "cpu/exec/template-end.h"
